import request from '@/utils/request'

// fix: 正式
const systemApi = {
  user: '/api/sysusers/getUserList',
  setUser: '/api/sysusers/postAddUsers',
  userInfo: '/api/sysusers/getUsersDetail',
  resetPassword: '/api/sysusers/UpdatePassword',
  deluser: '/api/sysusers/delUsers',
  department: '/api/department/getDepartmentList',
  departmentSelect: '/api/sysusers/getDepartment',
  delDepartment: '/api/department/delDepartment',
  setDepartment: '/api/department/postDepartment',
  role: '/api/role/getRoleList',
  roleSelect: '/api/sysusers/getRole',
  roleInfo: '/api/role/getRoleDetail',
  setRole: '/api/role/postRoles',
  delRole: '/api/role/delRoles',
  roleTree: '/api/role/getPowerInfoDrop',
  menu: '/api/powerinfo/getPowerInfoList',
  setMenu: '/api/powerinfo/postPowerInfo',
  delMenu: '/api/powerinfo/delPowerInfo',
  menuSelect: '/api/powerinfo/getPowerInfoDrop',
  parameter: '/api/csgl/getCsglPageList',
  addParameter: '/api/csgl/addCsgl',
  updateParameter: '/api/csgl/updateCsgl',
  delParameter: '/api/csgl/delCsgl',
  changeParameter: '/api/csgl/postCSUpDown',
  parameterInfo: '/api/csgl/details',
  updatePassword: '/api/sysusers/UpdatePassword'
}

export function getUserList (parameter) {
  return request({
    url: systemApi.user,
    method: 'get',
    params: parameter
  })
}

export function getUserInfo (parameter) {
  return request({
    url: systemApi.userInfo,
    method: 'get',
    params: parameter
  })
}

export function resetPassword (parameter) {
  return request({
    url: systemApi.resetPassword,
    method: 'get',
    params: parameter
  })
}

export function userUpdatePassword (parameter) {
  return request({
    url: systemApi.userUpdatePassword,
    method: 'post',
    data: parameter
  })
}

export function setUsers (parameter) {
  return request({
    url: systemApi.setUser,
    method: 'post',
    data: parameter
  })
}

export function delUsers (parameter) {
  return request({
    url: systemApi.deluser,
    method: 'get',
    params: parameter
  })
}

export function getDepartmentList (parameter) {
  return request({
    url: systemApi.department,
    method: 'get',
    params: parameter
  })
}

export function getDepartmentSelect (parameter) {
  return request({
    url: systemApi.departmentSelect,
    method: 'get',
    params: parameter
  })
}

export function setDepartments (parameter) {
  return request({
    url: systemApi.setDepartment,
    method: 'post',
    data: parameter
  })
}

export function delDepartments (parameter) {
  return request({
    url: systemApi.delDepartment,
    method: 'get',
    params: parameter
  })
}

// export function getDepartmentInfos (parameter) {
//   return request({
//     url: systemApi.getDepartmentInfo,
//     method: 'get',
//     params: parameter
//   })
// }

export function getRoleList (parameter) {
  return request({
    url: systemApi.role,
    method: 'get',
    params: parameter
  })
}

export function getRoleSelect (parameter) {
  return request({
    url: systemApi.roleSelect,
    method: 'get',
    params: parameter
  })
}

export function getRoleInfo (parameter) {
  return request({
    url: systemApi.roleInfo,
    method: 'get',
    params: parameter
  })
}

export function getRoleTrees (parameter) {
  return request({
    url: systemApi.roleTree,
    method: 'get',
    params: parameter
  })
}

export function setRoles (parameter) {
  return request({
    url: systemApi.setRole,
    method: 'post',
    data: parameter
  })
}

export function delRoles (parameter) {
  return request({
    url: systemApi.delRole,
    method: 'post',
    data: parameter
  })
}

export function getMenuList (parameter) {
  return request({
    url: systemApi.menu,
    method: 'get',
    params: parameter
  })
}

export function setMenus (parameter) {
  return request({
    url: systemApi.setMenu,
    method: 'post',
    data: parameter
  })
}

export function delMenu (parameter) {
  return request({
    url: systemApi.delMenu,
    method: 'get',
    params: parameter
  })
}

export function getMenuSelect (parameter) {
  return request({
    url: systemApi.menuSelect,
    method: 'get',
    params: parameter
  })
}

export function getParameterList (parameter) {
  return request({
    url: systemApi.parameter,
    method: 'get',
    params: parameter
  })
}

export function getParameterInfo (parameter) {
  return request({
    url: systemApi.parameterInfo,
    method: 'get',
    params: parameter
  })
}

export function addParameters (parameter) {
  return request({
    url: systemApi.addParameter,
    method: 'post',
    data: parameter
  })
}

export function updateParameters (parameter) {
  return request({
    url: systemApi.updateParameter,
    method: 'put',
    data: parameter
  })
}

export function delParameters (parameter) {
  return request({
    url: systemApi.delParameter,
    method: 'delete',
    params: parameter
  })
}

export function changeParameters (parameter) {
  return request({
    url: systemApi.changeParameter,
    method: 'post',
    data: parameter
  })
}

export function updatePassword (parameter) {
  return request({
    url: systemApi.updatePassword,
    method: 'put',
    data: parameter
  })
}
